package com.woniu.communitymanagement.controller;

import com.woniu.communitymanagement.entity.HttpResult;
import com.woniu.communitymanagement.entity.Records;
import com.woniu.communitymanagement.service.IRecordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/records")
@CrossOrigin(origins = "*")
public class RecordsController {

    @Autowired
    private IRecordsService iRecordsService;

    @RequestMapping("/list")
    public HttpResult getList(Integer typeId, String houseNumber, Integer pageIndex, Integer pageSize){
        return iRecordsService.getList(typeId,houseNumber,pageIndex,pageSize);
    }


    @PostMapping("/add")
    HttpResult addRecords(@RequestBody Records records){
        return iRecordsService.addRecords(records);
    }

    @RequestMapping("/update")
    HttpResult updateRecords(Records records){
        return iRecordsService.updateRecords(records);
    }

    @RequestMapping("/remove")
    HttpResult removeRecords(Integer id){
        return iRecordsService.removeRecords(id);
    }

    @RequestMapping("/info")
    HttpResult getInfo(Integer id){
        return iRecordsService.getInfo(id);
    }

}
